#!/usr/bin/env ruby
#
#
class RedBook::Messenger

	include Observable

	def info(message)
		msg :info, message
	end

	def debug(message)
		msg :debug, message
	end

	def success(message)
		msg :success, message
	end

	def warning(message)
		msg :warning, message
	end

	def error(message)
		msg :error, message
	end

	def notify(element, options)
		exec_callback :messenger_before_notify, element, options
		changed
		notify_observers(element, options={})
		exec_callback :messenger_after_notify, element, options
	end

	private

	def msg(type, message)
		notify({type => message})
	end

end
